package com.niit.service.impl;

import com.niit.dao.UserMapper;
import com.niit.pojo.User;
import com.niit.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;
    @Override
    public int addUser(User user) {return userMapper.addUser(user);}

    @Override
    public int deleteUser(int uid) {return userMapper.deleteUser(uid);}

    @Override
    public int updateUser(User user) {return userMapper.updateUser(user);}

    @Override
    public List<User> queryUser(User user) {
        // 调用UserMapper查询用户
        List<User> queriedUser = userMapper.query(user);
        return queriedUser;
    }

    @Override
    public User queryUser(int uid) {
        return userMapper.queryUserById(uid);
    }
}
